
import { useMemo } from "react";
import dynamic from "next/dynamic";
import { heatList } from "@/actions/action_heat";
import dayjs from "dayjs";
import GridCom from './_com/DynamicComponent'
export default async function CanvasPage({ searchParams }: {
  searchParams: {
    start: string,
    end: string,
  }
}) {
  searchParams = await searchParams
 
  const format = 'YYYY-MM-DD'
  let start = dayjs().subtract(90, 'day').format('YYYY-MM-DD')
  let end = dayjs().format('YYYY-MM-DD')
  // console.log(searchParams);
  if (searchParams.start) {
    start = dayjs(searchParams.start).format(format)
    end = dayjs(searchParams.end).format(format)
  }
  const dataLiat = await heatList(start, end)

  return <div>
    <GridCom dataList={dataLiat} timeList={[start, end]}></GridCom>
  </div>;
}